<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      canvas {
        border: 1px solid red;
      }
    </style>
  </head>
  <body>
    <div>
      <!-- <img src="../../images/原谅兽.jpg" alt="" /> -->
      <canvas width="600" height="600"
        >您的浏览器版本过低，不支持canvas，请升级浏览器</canvas
      >
    </div>
    <script>
      let canvas = document.querySelector("canvas");
      let ctx = canvas.getContext("2d");
      //   let img = document.querySelector("img");
      let img = new Image();
      img.src = "../../images/原谅兽.jpg";
      img.onload = function () {
        ctx.drawImage(img, 10, 0, 560, 560);
      };
    </script>
  </body>
</html>
